angular.module('mamApp').controller('transcodingAlbumCoverController', ['$scope', 'TranscodingManager', '$state', 'AlbumManager', 'ImsDialog','ImageManager',
    function ($scope, TranscodingManager, $state, AlbumManager, ImsDialog,ImageManager) {




        $scope.albumId = $state.params.albumId;
        $scope.albumName = $state.params.albumName;
        $scope.programId = $state.params.programId;


        AlbumManager.albumDetail( $scope.albumId).then(function (result) {
            $scope.album=result.data.adminAlbumVO;
            $scope.images=ImageManager.coverImageList($scope.album.albumCover);

        })


        $scope.imageReconvert = function (image) {

            ImsDialog.open({title: "转码确认", message: "确定为当前的图片重新转码吗？"}).then(function (a) {
                if (a == "ok") {

                    var params = {webUrl: $scope.album.albumCover, pixels:[image.imageWidth+"_"+image.imageHeight]};
                    TranscodingManager.imageReconvert(params).then(function (result) {
                        if (result.data.c == "s") {
                            $state.reload();
                        }
                    })
                }
            })


        }

    }])

